
from jsonrpc import RPC

import json

from test_hw import nc_customer
from test_hw import nc_product
from test_hw import nc_ods
from test_hw import nuonuo_test


# base_url = 'http://localhost:8069'
base_url = 'http://43.143.148.83:8069'
base_url = 'http://43.143.148.83:8069'

timeout = 50000


dbname = 'FP_RAW'
dbname = 'baiwang_nc_base'
username = 'admin'
password = 'sdhw05363721'


rpc = RPC(base_url, timeout, dbname)
rpc.login(username, password)


def test_user():
    rpc.login(username, password)
    so = rpc.env.model('res.users')
    ids = so.test()

    print(ids)


def import_cust():
    # nc_customer.customer()
    nc_customer.import_customer(rpc)
    nc_customer.load_for_partner(rpc)


def import_prd():
    nc_product.import_product(rpc)
    nc_product.load_for_product(rpc)


def import_sale():
    nc_ods.test_fp_so_create(rpc)


def update_prd():
    nc_product.update_product(rpc)


def access_token():
    nuonuo_test.access_token(rpc)


def fp_so_read_json():
    res = nc_ods.test_fp_so_read_json(rpc)


# nc sale order
# todo sale order line,  product

# import_prd()
# import_cust()
# import_sale()


# update_prd()

# access_token()


fp_so_read_json()
